package com.zbkj.front.controller;

import com.zbkj.common.response.CommonResult;
import com.zbkj.common.vo.CourseVideoVo;
import com.zbkj.service.service.CourseVideoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 课程视频前端控制器
 */
@Slf4j
@RestController("FrontCourseVideoController")
@RequestMapping("api/front/course/video")
@Api(tags = "课程-视频")
public class CourseVideoController {

    @Autowired
    private CourseVideoService courseVideoService;

    /**
     * 根据课程ID获取视频列表
     * @param courseId 课程ID
     */
    @ApiOperation(value = "获取课程视频列表")
    @RequestMapping(value = "/{courseId}", method = RequestMethod.GET)
    public CommonResult<List<CourseVideoVo>> getByCourseId(@PathVariable(value = "courseId") Integer courseId) {
        return CommonResult.success(courseVideoService.getByCourseId(courseId));
    }
}